package com.diy.springframework.step01;

import com.diy.springframework.step01.BeanDefinition01;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @program: diy_spring
 * @description:
 * @author: CaoYong
 * @create: 2021-07-21 08:26
 **/
public class BeanFactory01 {

    private Map<String, BeanDefinition01> beanDefinitionMap = new ConcurrentHashMap<>();

    public Object getBean(String name) {
        return beanDefinitionMap.get(name).getBean();
    }

    public void registerBeanDefinition(String name, BeanDefinition01 beanDefinition) {
        beanDefinitionMap.put(name, beanDefinition);
    }
}
